# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=cppunit
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.15.1
pkgrel=1
pkgdesc="A C++ unit testing framework (mingw-w64)"
arch=('any')
url="https://www.freedesktop.org/wiki/Software/cppunit"
license=("LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
options=('staticlibs' 'strip')
source=("https://dev-www.libreoffice.org/src/${_realname}-${pkgver}.tar.gz")
sha256sums=('89c5c6665337f56fd2db36bc3805a5619709d51fb136e51937072f63fcc717a7')

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}
}

build() {
  [[ -d ${srcdir}/build-${MINGW_CHOST} ]] && rm -rf ${srcdir}/build-${MINGW_CHOST}
  mkdir -p ${srcdir}/build-${MINGW_CHOST} && cd ${srcdir}/build-${MINGW_CHOST}
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-shared \
    --enable-static \
    --disable-doxygen

  make
}

check() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make check
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
}
